package com.example.service.impl;

import com.example.pojo.cabinetKeyPojo;
import com.example.service.cabinetKeyService;
import com.example.mapper.cabinetKeyMapp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service  // 注解：将该类注册为 Spring Bean
public class cabinetKeyServiceImpl implements cabinetKeyService {

    @Autowired
    private cabinetKeyMapp cabinetKeyMapp;  // 注入 Mapper 层

    @Override
    public List<cabinetKeyPojo> queryAll() {
        return cabinetKeyMapp.queryAll();  // 调用 Mapper 层查询所有数据
    }

    @Override
    public void insertOne(cabinetKeyPojo cabinetKeyPojo) {
        cabinetKeyMapp.insertOne(cabinetKeyPojo);  // 调用 Mapper 层插入数据
    }

    @Override
    public void updateCabinetKey(cabinetKeyPojo cabinetKeyPojo) {
        cabinetKeyMapp.updateCabinetKey(cabinetKeyPojo);  // 调用 Mapper 层更新数据
    }

    @Override
    public void editCabinetKey(cabinetKeyPojo cabinetKeyPojo) {
        updateCabinetKey(cabinetKeyPojo);  // 这里假设 editCabinetKey 实际是调用 updateCabinetKey 方法
    }
}
